<template>
  <div id="app">
    <Header :key="updateKey" @updateKeyFn="updateKeyFn" />
    <Nav />
    <router-view />
    <Footer />
    <Login  @updateKeyFn="updateKeyFn" />
    <transition name="fade">
      <Toast v-show="$store.state.toast.show" />
    </transition>
  </div>
</template>

<script>
import Header from "@/components/Header.vue";
import Nav from "@/components/Nav.vue";
import Footer from "@/components/Footer.vue";
import Login from "@/components/Login.vue";
import Toast from "@/components/Toast.vue";
export default {
  data() {
    return {
      updateKey: 0
    };
  },
  components: {
    Header,
    Nav,
    Footer,
    Login,
    Toast
  },
  methods: {
    updateKeyFn() {
      this.updateKey++;
    }
  }
};
</script>

<style lang="less">
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s linear;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  opacity: 0;
}
.fade-enter-to,
.fade-leave {
  opacity: 1;
}
</style>
